/**********************************************************************
 *
 * $RCSfile: CompMgtTemplateListener.java,v $  $Revision: 1.1 $  $Date: 2009/06/03 06:25:03 $
 *
 * $Log: CompMgtTemplateListener.java,v $
 * Revision 1.1  2009/06/03 06:25:03  @author simplefan
 * *** empty log message ***
 *
 *
 *
 *********************************************************************/
/*
 * Copyright 2008 gxlu, Inc. All rights reserved.
 * File name : CompMgtTemplateListener.java
 * Created on : Jun 2, 2009 12:56:33 PM
 * Creator : lethe
 */
package com.simplefan.meta.determine.client.web.listener;

import java.util.List;

import com.bstek.dorado.common.DoradoContext;
import com.bstek.dorado.data.Dataset;
import com.simplefan.meta.determine.client.desktop.service.MetaPlatformServiceFacade;
import com.simplefan.meta.determine.common.po.CompMgtTemplate;

/**
 * <pre>
 * Description : TODO
 * @author simplefan
 * </pre>
 */
public class CompMgtTemplateListener extends MetaPlatformListener {
	@Override
  public void afterLoadData(Dataset dataset) throws Exception {
		super.afterLoadData(dataset);
		MetaPlatformServiceFacade facade = getServiceFacade();
		String componentSpecId = DoradoContext.getContext().getParameter("componentSpecId");
		if (componentSpecId == null || componentSpecId.length() == 0) {
			componentSpecId = dataset.parameters().getString("componentSpecId");
		}
		if (componentSpecId != null && componentSpecId.length() > 0) {
			List<CompMgtTemplate> list = facade.getServiceFactory().getMetaPlatformService()
					.queryCompMgtTemplateByCompSpecId(Long.parseLong(componentSpecId));

			dataset.fromDO(list);
		}
	}
}
